The Border Gateway Protocol (BGP) is an interautonomous system routing protocol. An autonomous system (AS) is a network or group of networks under a common administration and with common routing policies. BGP is used to exchange routing information for the Internet and is the protocol used between Internet service providers (ISP). Customer networks usually employ an Interior Gateway Protocol (IGP) such as Routing Interior Protocol (RIP), which specifies how routers exchange routing table information. With RIP, routers periodically exchange entire tables. Another IGP is known as Open Shortest Path First (OSPF) protocol. In OSPF the routers use link-state algorithms to send routing information to all nodes in an internetwork by calculating the shortest path to each node based on a topography of the network constructed by each node. Each router sends the particular portion of the routing table that describes the state of its own links, and it also sends the complete routing structure (topography). An advantage of OSPF is that it results in smaller more frequent updates everywhere. The updates converge quickly, thus preventing such problems as routing loops and Count-to-Infinity (when routers continuously increment the hop count to a particular network). This makes for a more stable network.
Customers connect to ISPs, and ISPs use BGP to exchange customer and ISP routes. When BGP is used between autonomous systems the protocol is referred to as External BGP (EBGP). If a service provider is using BGP to exchange routes within an AS, then the protocol is referred to as Interior BGP (IBGP). BGP neighbors exchange full routing information when the TCP connection between neighbors is first established. When changes to the routing table are detected, the BGP routers send to their neighbors only those routes that have changed. BGP routers do not send periodic routing updates, and BGP routing updates advertise only the optimal path to a destination network.
BGP uses many route parameters, called attributes, to define routing policies and maintain a stable routing environment. Routes learned via BGP have associated properties (also referred to as attributes) that are used to determine the best route to a destination when multiple paths exist to a particular destination. These attributes include: Weight, Local Preference, Multi-Exit Discriminator, Origin, AS_Path, Next Hop and Community.
The Weight attribute is local to a router. The Weight attribute is not advertised to neighboring routers. If the router learns about more than one route to the same destination, the route with the highest weight will be preferred.
The Local Preference attribute is used to prefer an exit point from the local autonomous system (AS). Unlike the Weight attribute, the Local Preference attribute is propagated throughout the local AS. If there are multiple exit points from the AS, the Local Preference attribute is used to select the exit point for a specific route.
The Multi-Exit Discriminator (MED) or metric attribute is used as a suggestion to an external AS regarding the preferred route into the AS that is advertising the metric. The external AS that is receiving the MEDs may be using other BGP attributes for route selection.
The Origin attribute indicates how BGP learned about a particular route. The Origin attribute can have one of three possible values. A first possible value for the Origin attribute is IGP wherein the route is interior to the originating AS. This value is set when the network router configuration command is used to inject the route into BGP. Another possible value for the Origin attribute is EGP wherein the route is learned via the Exterior Border Gateway Protocol. A third possible value for the Origin attribute is Incomplete wherein the origin of the route is unknown or learned in some other way. An origin value of incomplete occurs when a route is redistributed into BGP. The Origin attribute is used for route selection.
The AS_Path attribute is used when a route advertisement passes through an AS. The AS number is added to an ordered list of AS numbers that the route advertisement has traversed.
The Next-Hop attribute is the IP address that is used to reach the advertising router. For EBGP peers, the next-hop address is the IP address of the connection between the peers. For IBGP, the EBGP next-hop address is carried into the local AS.
The Community attribute provides a way of grouping destinations, called communities, to which routing decisions (such as acceptance, preference, and redistribution) can be applied. Route maps are used to set the community attribute. Predefined community attributes include a no-export attribute, a no-advertise attribute and an Internet attribute. The no-export attribute denotes that this route should not be advertised to EBGP peers. The no-advertise attribute indicates that this route should not be advertised to any peer. The Internet attribute signifies this route should be advertised to the Internet community as all routers in the network belong to it.
BGP could possibly receive multiple advertisements for the same route from multiple sources. BGP selects only a single path as the best path. When the best path is selected, BGP puts the selected path in the IP routing table and propagates the path to its neighbors. BGP uses the following criteria, in the following order, to select a path for a destination:
1. If the path specifies a next hop that is inaccessible, drop the update.
2. Prefer the path with the largest weight.
3. If the weights are the same, prefer the path with the largest local preference.
4. If the local preferences are the same, prefer the path that was originated by BGP running on this router.
5. If no route was originated, prefer the route that has the shortest AS_path.
6. If all paths have the same AS_path length, prefer the path with the lowest origin type (where IGP is lower than EGP, and EGP is lower than incomplete).
7. If the origin codes are the same, prefer the path with the lowest MED attribute.
8. If the paths have the same MED, prefer the external path over the internal path.
9. If the paths are still the same, prefer the path through the closest IGP neighbor.
10. Prefer the path with the lowest IP address, as specified by the BGP router ID.
BGP also has mechanisms such as Outbound Route Filtering (ORF) which enable the proper set of Virtual Private Network (VPN) routing distribution constraints to be dynamically distributed. This reduces the management burden of setting up the constraints, and results in improved scalability.
Within a single routing domain it is common to have the IBGP routers peer directly with one or two route reflectors (described below), rather than having them peer directly with each other. This greatly reduces the number of IBGP adjacencies which any one router must support. Further, a route reflector does not merely redistribute routing information, it “digests” the information first, by running its own decision processes. Only routes which survive the decision process are redistributed.
A route reflector reflects routes between the two groups: client peers and all the other routers in the autonomous system (non-client peers). The route reflector and its client peers form a cluster. The non-client peers are fully meshed with each other, but the client peers need not be fully meshed. When the route reflector receives an advertised route from an external BGP speaker, the route is advertised to all clients and non-client peers. When the route reflector receives an advertised route from a non-client peer, the route is advertised to all clients. When the route reflector receives a route from a client, the route is advertised to all clients and non-client peers. Hence, the clients need not be fully meshed.
As a result, when route reflectors are used, the amount of routing information carried around the network, and in particular, the amount of routing information which any given router must receive and process, is greatly reduced. This greatly increases the scalability of the routing distribution system.